Notify viewers when documents update - #28
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62676ddff7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 62676dd. Configure here.
rgarcia
left a comment
There was a problem hiding this comment.
reviewed incrementally — implementation, authorization boundaries, cache invalidation, polling behavior, and tests look good.

summary
updated · refreshcontrol when newer content existstests
npm testnpx tsc --noEmitnpm run buildNote
Medium Risk
Touches viewer auth/session behavior for a new hot path and changes how
/d/*abuse is throttled (edge firewall vs in-app DB limits); cache invalidation must stay aligned with writes or viewers may see stale version numbers briefly.Overview
Adds live “document updated” awareness in the viewer shell: while the tab is visible, the client polls a new lightweight
GET /d/:slug/versionendpoint every 30 seconds and shows anupdated · refreshcontrol when the server version is newer than what the page loaded with. A full reload is explicit (user click); inline-edit 409 conflicts also surface the same refresh affordance.The version route returns plain text with
private, no-store, reuses viewer auth (view token / public skip session; otherwisegetSessionReadOnlyso polling does not slide session expiry), and reads through a taggedunstable_cache(30s) invalidated on every document mutation path instore.Viewer rate limiting moves from per-IP Postgres counters on
/d/:slug/rawandpreviewto a Vercel firewall rule on/d/(300 req / 60s / IP). Ops getnpm run firewall:configureplus DEVELOPMENT.md notes;RL_VIEWER_PER_MINand related app-side checks are removed.Reviewed by Cursor Bugbot for commit a403259. Bugbot is set up for automated code reviews on this repo. Configure here.